<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/3/12
 * Time: 16:15
 */

echo "<title>7-6 foreach循环访问索引数组里的值</title>";
echo "<p style='text-align: center'><a href=\"index.php\"><font size=\"4\">目录</font></a></p>";
header("Content-type: text/html; charset=utf-8");
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";

$fruit=array('苹果','香蕉','菠萝');
foreach($fruit as $key=>$value){
    echo '<br>'.$key.'值是：'.$value;
}

//foreach循环可以将数组里的所有值都访问到，下面我们展示下，用foreach循环访问索引数组里的值。